// type annot#1 ,\r
{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // 0x00\r
\r
- 0x00, 0x00, 0x00, 0x00, \r
+ 0x00, 0x00, 0x00, 0x00,\r
\r
//show length,\r
// order\r
//behind roads\r
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
// blue 2pt\r
- 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, \r
+ 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,\r
// show line\r
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, \r
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \r
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\r
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
0x00};\r
\r
//struct parameters {\r
if (annot_rec==NULL)\r
return;\r
//for(i=0; i<annot_rec->line_points)\r
- xfree(annot_rec->buf);\r
- xfree(annot_rec->text);\r
- xfree(annot_rec);\r
+ free(annot_rec->buf);\r
+ free(annot_rec->text);\r
+ free(annot_rec);\r
}\r
\r
struct annotations * annotations_new()\r
\r
for (i=0; i<annots->num_annotations; i++)\r
annot_rec_delete(annots->annot_list[i]);\r
- xfree(annots->annot_list);\r
- xfree(annots->header_buf);\r
- xfree(annots);\r
+ free(annots->annot_list);\r
+ free(annots->header_buf);\r
+ free(annots);\r
}\r
\r
struct gpxpt* gpx_get_point(char* buf)\r
}\r
}\r
\r
- if (rec->type == ANNOT_TYPE_LINE) \r
+ if (rec->type == ANNOT_TYPE_LINE)\r
rec->line_offset = line_offset;\r
\r
if (rec->type<4)\r
rec_type =annot_type_name[rec->type];\r
- else \r
+ else\r
rec_type=NULL;\r
\r
if (opts.verbose_flag > 4)\r
{\r
rec = read_annot_rec(annot_in_file, annots->version);\r
\r
- // current version of explore annots is a bit childish\r
-// if (opts.explore_flag)\r
-// explore_annot(rec);\r
+ if (opts.explore_flag)\r
+ explore_annot(rec);\r
if (rec==NULL)\r
{\r
annots->read_recs_ok_flag = 0;\r
}\r
else\r
annots->read_tail_ok_flag=1;\r
- xfree(checkEOF);\r
+ free(checkEOF);\r
}\r
fclose(annot_in_file);\r
return annots;\r
\r
void contents_delete(struct contents * conts)\r
{\r
- xfree(conts->list_f_pcbtext);\r
- xfree(conts->list_f_text);\r
- xfree(conts->buf);\r
- xfree(conts);\r
+ if(conts != NULL)\r
+ {\r
+ free(conts->list_f_pcbtext);\r
+ free(conts->list_f_text);\r
+ free(conts->buf);\r
+ }\r
+ free(conts);\r
}\r
\r
void print_f_contents0(struct f_contents0 * conts)\r
printf("Array[%d]=%d - unknown meaning\n", i, conts->f_conts_array[i]);\r
\r
printf("n:=Array[3]=%d is number of user pushpin sets\n", (conts->f_conts_array)[3]);\r
- \r
+\r
// for(i=0; i< (conts->f_conts_array[3]); i++)\r
-// printf("Array[%d]=%d is SetId for user PushpinSet[%d] \n", \r
+// printf("Array[%d]=%d is SetId for user PushpinSet[%d] \n",\r
// 4+i,\r
// conts->f_conts_array[4+i],\r
-// conts->f_conts_array[3] - i -1); \r
+// conts->f_conts_array[3] - i -1);\r
\r
for(i=0; i< (conts->f_conts_array[3]); i++)\r
printf("Array[4+n-(%d)]=%d is SetId for user PushpinSet[%d]\n",\r
i, conts->f_conts_array[3+(conts->f_conts_array[3])-i], i);\r
- \r
+\r
for(i=0; (4 + (conts->f_conts_array[3] +i)) < (conts->f_conts0->array_len)/2 ; i++)\r
printf("Array[5+n+(%d)]=%d - unknown meaning\n",\r
i, conts->f_conts_array[4+(conts->f_conts_array[3])+i]);\r
debug_pause();\r
\r
// printf("Dumping Contents array tail:\n");\r
-// printbuf((char*)(conts->f_conts_array + 4 + conts->f_conts_array[3]), \r
+// printbuf((char*)(conts->f_conts_array + 4 + conts->f_conts_array[3]),\r
// (conts->f_conts0->array_len)-2*(4 + conts->f_conts_array[3]) );\r
}\r
\r
{\r
temp_str=buf2str(conts->f_text0, *(conts->f_pcbtext0));\r
printf("Got Text0='%s'\n", temp_str);\r
- xfree(temp_str);\r
+ free(temp_str);\r
temp_str=NULL;\r
}\r
\r
{\r
temp_str=buf2str(conts->f_text1, conts->f_conts1->cbText1);\r
printf("Got Text1='%s'\n", temp_str);\r
- xfree(temp_str);\r
+ free(temp_str);\r
temp_str=NULL;\r
}\r
\r
{\r
temp_str = buf2str(conts->list_f_text[i], *(conts->list_f_pcbtext[i]));\r
printf("Got list_text[%d]='%s'\n", i, temp_str);\r
- xfree(temp_str);\r
+ free(temp_str);\r
}\r
}\r
\r
// **************************\r
\r
conts->pusunkn0 = (unsigned short*)(conts->buf+buf_pos);\r
- \r
+\r
buf_pos += sizeof(unsigned short);\r
if (buf_pos>(conts->buf_len))\r
{\r
temp_str=buf2str(conts->CountryText, conts->f_conts3->cbCountryText);\r
if(opts.explore_flag)\r
printf("Got CountryText='%s'\n", temp_str);\r
- xfree(temp_str);\r
+ free(temp_str);\r
temp_str=NULL;\r
}\r
\r
conts->fully_parsed_flag=1;\r
else\r
{\r
- printf("Unexpected %d bytes of contents buffer still remaining.\n", \r
+ printf("Unexpected %d bytes of contents buffer still remaining.\n",\r
(conts->buf_len)-buf_pos);\r
printbuf((conts->buf)+buf_pos, (conts->buf_len)-buf_pos);\r
}\r
}\r
}\r
\r
-int fixhex(char c)\r
-{\r
-// gcc (version?) does not print single byte hex values properly\r
-// eg 0xe3 prints as 0xFFFFFFE3\r
-// this is only a problem for values above 0x80\r
-// Or maybe that is the proper handling of unsigned?\r
-// Aaaahhh. I should use %u for printing unsigned... but the hex problem is still there\r
- if(c & 0x80)\r
- {\r
- return ((int)c-0xFFFFFF00);\r
- } else\r
- return c;\r
-}\r
-\r
void printbuf(char* buf, int len)\r
{\r
-// unsigned i;\r
int i;\r
printf(" 0 1 2 3 4 5 6 7 8 9 A B C D E F\n");\r
printf(" -----------------------------------------------");\r
{\r
if (((i+1) & 0x0f) == 0x1)\r
printf("\n%2x| ",i/16);\r
- printf("%2x ",fixhex(buf[i]));\r
- }\r
- printf("\n\n");\r
-}\r
-\r
-void printbufwide(char* buf, int len)\r
-{\r
- int i;\r
- for(i=0; i<len; i++)\r
- {\r
- printf("%2x ",fixhex(buf[i]));\r
- }\r
- printf("\n\n");\r
-}\r
-\r
-void printbufhigh(char* buf, int len)\r
-{\r
- int i;\r
- for(i=0; i<len; i++)\r
- {\r
- printf("%02x %02x\n", i, fixhex(buf[i]));\r
- }\r
- printf("\n\n");\r
-}\r
-\r
-void printbufasfloat(char* buf, int len)\r
-{\r
-// unsigned i;\r
- int i;\r
-// printf(" 0 1 2 3 4 5 6 7 8 9 A B C D E F\n");\r
-// printf(" -----------------------------------------------");\r
- for(i=0; i<len-3; i++)\r
- {\r
- if (((i+1) & 0x03) == 0x1)\r
- printf("\n%2x| ",i);\r
- printf("%f ", *(float*)(buf+i));\r
- fflush(stdout);\r
- }\r
- printf("\n\n");\r
-}\r
-\r
-void printfloatbuf(float* fbuf, int len)\r
-{\r
-// unsigned i;\r
- int i;\r
-// printf(" 0 1 2 3 4 5 6 7 8 9 A B C D E F\n");\r
-// printf(" -----------------------------------------------");\r
- for(i=0; i<len; i++)\r
- {\r
- if (((i+1) & 0x03) == 0x1)\r
- printf("\n%2x| ",4*i);\r
- printf("%f ", fbuf[i]);\r
- fflush(stdout);\r
+ printf("%2x ", (unsigned char)buf[i]);\r
}\r
printf("\n\n");\r
}\r
void printpoints(char* buf, int numpts)\r
{\r
int i;\r
-// int j;\r
struct gpxpt* pt;\r
printf("Latitude Longitude Height");\r
printf("\n");\r
printf("\n\n");\r
}\r
\r
-void printpointsbuf(char* buf, int len)\r
-{\r
-// unsigned i;\r
-// unsigned j;\r
- int i;\r
- int j;\r
- printf(" 0 1 2 3 4 5 6 7 8 9 A B\n");\r
- printf(" -----------------------------------");\r
- for(i=0; i<len; i++)\r
- {\r
- printf("\n%2x| ",i);\r
- // printf("\n");\r
- for (j=0; j<12; j++)\r
- {\r
- printf("%2x ",fixhex(buf[12*i+j]));\r
- fflush(stdout);\r
- }\r
- }\r
- printf("\n\n");\r
-}\r
-\r
-void printbufaspoints(char* buf, int buflen)\r
-{\r
- int i;\r
-// int j;\r
- struct gpxpt * pt;\r
- printf("Latitude Longitude Height");\r
- printf("\n");\r
- printf("--------------------------\n");\r
- for(i=0; i<buflen-11; i++)\r
- {\r
- pt = gpx_get_point(buf + 12*i);\r
- printf("%#02x %f N %f E %f m \n", i, pt->lat, pt->lon, pt->elevation);\r
- gpxpt_delete(pt);\r
- fflush(stdout);\r
- }\r
- printf("\n\n");\r
-}\r
-\r
-void printnzbuf(char* buf, int len)\r
-{\r
-// print non-zero values in the buffer\r
-// unsigned i;\r
- int i;\r
- for(i=0; i<len; i++)\r
- {\r
-// if (buf[i] != 0) printf("Buf[%x]=%2x ",fixhex(i), fixhex(buf[i]));\r
- if (buf[i] != 0) printf("Buf[%x]=%2x ",i, fixhex(buf[i]));\r
- }\r
- printf("\n");\r
-}\r
-\r
-//void printnzhead(struct annot_rec rec)\r
-//{\r
-// printnzbuf(rec.buf, annot_head_len[rec.type]);\r
-//}\r
-\r
void explore_annot(struct annot_rec * rec)\r
{\r
- char* header;\r
- char* tail;\r
- int taillength;\r
-\r
- header = (char*)xmalloc(ANNOT_REC_HEAD_LEN);\r
- memcpy(header, rec->buf, ANNOT_RECOS_TEXT);\r
- memcpy(header+ANNOT_RECOS_TEXT+2*rec->text_length, rec->buf,\r
- ANNOT_REC_HEAD_LEN-ANNOT_RECOS_TEXT);\r
-\r
- tail = rec->buf+ANNOT_REC_HEAD_LEN+2*rec->text_length;\r
- taillength = rec->length - ANNOT_REC_HEAD_LEN+2*rec->text_length;\r
-\r
- printf("Record buffer\n", annot_type_name[rec->type]);\r
- printbuf(rec->buf, rec->length);\r
- printf("Record high buffer\n", annot_type_name[rec->type]);\r
- printbufhigh(rec->buf, rec->length);\r
- printf("Record wide header:\n", annot_type_name[rec->type]);\r
- printbufwide(header, ANNOT_REC_HEAD_LEN);\r
- printf("Record tail:\n");\r
- printbuf(tail, taillength);\r
- printf("Record wide tail:\n");\r
- printbufwide(tail, taillength);\r
- printf("Record tail as floats:\n");\r
- printbufasfloat(tail, taillength);\r
- printf("Record tail as points:\n");\r
- printbufaspoints(tail, taillength);\r
-// if (rec->type == ANNOT_TYPE_TEXT)\r
-// {\r
- //printfloatbuf((float*)(tail+3), taillength/4 -1);\r
-// }\r
-// else if (rec->type == ANNOT_TYPE_OVAL )\r
-// printfloatbuf((float*)(tail+3), taillength/4 -1);\r
-// else if (rec->type == ANNOT_TYPE_CIRCLE ))\r
-// printfloatbuf((float*)(tail+3), taillength/4 -1);\r
- xfree(header);\r
}\r
\r
void print_f_jour_header(struct f_jour_header * head)\r
printf("iunkn0 %#x=%d\n", pt_head->iunkn0, pt_head->iunkn0);\r
printf("sched_arrive_flag %d\n", pt_head->sched_arrive_flag);\r
printf("sched_depart_flag %d\n", pt_head->sched_depart_flag);\r
- printf("arrive_time_secs %d\n", pt_head->arrive_time_secs); \r
+ printf("arrive_time_secs %d\n", pt_head->arrive_time_secs);\r
printf("depart_time_secs %d\n", pt_head->depart_time_secs);\r
printf("iunkn1 %#x=%d\n", pt_head->iunkn1, pt_head->iunkn1);\r
// x = pt_head->unkn_scaled_lon;\r
// x = x*360/0x10000;\r
// x = x/0x10000;\r
- printf("scaled_lon %d gives lon %f\n", \r
+ printf("scaled_lon %d gives lon %f\n",\r
pt_head->scaled_lon, scaled2deg(pt_head->scaled_lon));\r
// x = (pt_head->unkn_scaled_lat*360/0x10000);\r
// x = x/0x10000;\r
- printf("scaled_lat %d gives lat %f\n", \r
+ printf("scaled_lat %d gives lat %f\n",\r
pt_head->scaled_lat, scaled2deg(pt_head->scaled_lat));\r
printf("cbtext1 %d\n",pt_head->cbtext1);\r
printbuf((char*)pt_head, sizeof(struct f_jour_pt_head));\r
printf("road_id %x=%d\n", pt_tail->road_id, pt_tail->road_id);\r
printf("dist_along_rd_frac %lf \n", pt_tail->dist_along_rd_frac);\r
\r
- printf("rd_arrive_sc_lat %d gives lat %f\n", \r
+ printf("rd_arrive_sc_lat %d gives lat %f\n",\r
pt_tail->rd_arrive_sc_lat, scaled2deg(pt_tail->rd_arrive_sc_lat));\r
\r
- printf("rd_arrive_sc_lon %d gives lat %f\n", \r
+ printf("rd_arrive_sc_lon %d gives lat %f\n",\r
pt_tail->rd_arrive_sc_lon, scaled2deg(pt_tail->rd_arrive_sc_lon));\r
\r
- printf("rd_depart_sc_lat %d gives lat %f\n", \r
+ printf("rd_depart_sc_lat %d gives lat %f\n",\r
pt_tail->rd_depart_sc_lat, scaled2deg(pt_tail->rd_depart_sc_lat));\r
\r
- printf("rd_depart_sc_lon %d gives lat %f\n", \r
+ printf("rd_depart_sc_lon %d gives lat %f\n",\r
pt_tail->rd_depart_sc_lon, scaled2deg(pt_tail->rd_depart_sc_lon));\r
\r
printf("iunkn8 %x=%d\n", pt_tail->iunkn8, pt_tail->iunkn8);\r
int i;\r
// This is only the main stuff\r
printf("Annotations list, version=%d, num_annotations=%d, max_annot_num=%d, stream_length=%d\n",\r
- annots->version, annots->num_annotations, \r
+ annots->version, annots->num_annotations,\r
annots->max_annot_num, annots->stream_length);\r
- \r
+\r
for(i=0; i<annots->num_annotations; i++)\r
print_annot_rec(annots->annot_list[i]);\r
}\r
{\r
if (jourpt==NULL)\r
return;\r
- xfree(jourpt->text1);\r
- xfree(jourpt->text2);\r
+ free(jourpt->text1);\r
+ free(jourpt->text2);\r
// This is part of an array, so free the array\r
- //xfree(jourpt);\r
+ //free(jourpt);\r
}\r
\r
struct journey * journey_new()\r
return;\r
for(i=0; i< jour->count_rtepts; i++)\r
jour_rtept_delete(jour->rtept_list + i);\r
- xfree(jour->rtept_list);\r
- xfree(jour->avoid_os_list);\r
- xfree(jour->buf);\r
- xfree(jour);\r
+ free(jour->rtept_list);\r
+ free(jour->avoid_os_list);\r
+ free(jour->buf);\r
+ free(jour);\r
}\r
\r
\r
-struct journey * process_journey_stream (char* jour_in_file_name, \r
+struct journey * process_journey_stream (char* jour_in_file_name,\r
struct pushpin_safelist * ppplist)\r
{\r
int j;\r
fprintf(stderr, "Quitting because I cannot open %s\n", jour_in_file_name);\r
exit(1);\r
}\r
- \r
+\r
bytes2read=sizeof(struct f_jour_header);\r
jour->buf=(char*)xmalloc(jour->buf_len+bytes2read);\r
status = readbytes(jour_in_file, jour->buf, bytes2read);\r
memcpy(jour->rtept_list[j].text1, jour->buf + jour->buf_len, bytes2read);\r
jour->rtept_list[j].text1[bytes2read]=0;\r
jour->buf_len += bytes2read;\r
- \r
+\r
str2ascii(jour->rtept_list[j].text1);\r
}\r
if (opts.explore_flag)\r
lat=jour->rtept_list[j].pushpin->lat;\r
lon=jour->rtept_list[j].pushpin->lon;\r
\r
- printf("Matching pushpin Grid %#x=%d, Precision %#x=%d, MOBBId %#x=%d\n", \r
- jour->rtept_list[j].pushpin->Grid, \r
- jour->rtept_list[j].pushpin->Grid, \r
- jour->rtept_list[j].pushpin->Precision, \r
- jour->rtept_list[j].pushpin->Precision, \r
- jour->rtept_list[j].pushpin->MOBBId, \r
+ printf("Matching pushpin Grid %#x=%d, Precision %#x=%d, MOBBId %#x=%d\n",\r
+ jour->rtept_list[j].pushpin->Grid,\r
+ jour->rtept_list[j].pushpin->Grid,\r
+ jour->rtept_list[j].pushpin->Precision,\r
+ jour->rtept_list[j].pushpin->Precision,\r
+ jour->rtept_list[j].pushpin->MOBBId,\r
jour->rtept_list[j].pushpin->MOBBId);\r
\r
- printf("Matching pushpin Lat %f Lon %f\n", \r
- jour->rtept_list[j].pushpin->lat, \r
+ printf("Matching pushpin Lat %f Lon %f\n",\r
+ jour->rtept_list[j].pushpin->lat,\r
jour->rtept_list[j].pushpin->lon);\r
\r
x = cos(lon*M_PI/180)*cos(lat*M_PI/180);\r
y = sin(lon*M_PI/180)*cos(lat*M_PI/180);\r
z = sin(lat*M_PI/180);\r
\r
- printf("For matching pushpin X=%f Y=%f Z=%f\n", x,y,z); \r
+ printf("For matching pushpin X=%f Y=%f Z=%f\n", x,y,z);\r
}\r
*/\r
}\r
jour->buf=(char*)xrealloc(jour->buf, jour->buf_len+bytes2read);\r
status = readbytes(jour_in_file, jour->buf + jour->buf_len, bytes2read);\r
if (status!=bytes2read)\r
- { \r
+ {\r
printf("Unexpected EOF in the Journey stream, options eur10\n");\r
fclose(jour_in_file);\r
return jour;\r
int i;\r
if (ppl==NULL)\r
return;\r
- \r
+\r
for (i=0; i<ppl->num_pushpins; i++)\r
pushpin_delete(ppl->pushpin_list[i]);\r
- \r
- xfree(ppl->pushpin_list);\r
- \r
+\r
+ free(ppl->pushpin_list);\r
+\r
for(i=0; i<3; i++)\r
- xfree(ppl->UDM_Data[i]);\r
+ free(ppl->UDM_Data[i]);\r
\r
- xfree(ppl);\r
+ free(ppl);\r
}\r
\r
struct pushpin * pushpin_new()\r
{\r
if(pp==NULL)\r
return;\r
- xfree(pp->NoteShort);\r
- xfree(pp->UdName);\r
- xfree(pp);\r
+ free(pp->NoteShort);\r
+ free(pp->UdName);\r
+ free(pp);\r
}\r
\r
-struct point grid2latlon(long grid, long precision) \r
-//struct point ms2latlong(struct ms_point msp) \r
+struct point grid2latlon(long grid, long precision)\r
+//struct point ms2latlong(struct ms_point msp)\r
{\r
// Convert the 2 long values in UserData stream to GPS coordinates.\r
\r
p.lon=-180;\r
return p;\r
}\r
- for(i=0; i<16; i++) \r
+ for(i=0; i<16; i++)\r
{\r
lat_val += (lat_mask & grid) >> i;\r
lon_val += (lon_mask & grid) >> (i+1);\r
lat_val=0;\r
lon_val=0;\r
\r
- for (i=0; i<16; i++) \r
+ for (i=0; i<16; i++)\r
{\r
lat_val += (lat_mask & precision) >> i;\r
lon_val += (lon_mask & precision) >> (i+1);\r
if (p.lon > 180) p.lon -= 360;\r
if (p.lat > 180) p.lat -= 360;\r
\r
- if ( (p.lat > 90) || (p.lat < -90) ) \r
+ if ( (p.lat > 90) || (p.lat < -90) )\r
{\r
printf("Got bad lat value %f converting pushpin data, setting.\n");\r
// p.lat=-180;\r
msp.grid += ((mask & lon_grid_ndx) << (i+1));\r
mask <<= 1;\r
}\r
- \r
+\r
mask=1;\r
for(i=0; i<16; i++) {\r
msp.precision += ((mask & lat_prec_ndx) << i);\r
typedef struct FORMATIDOFFSET\r
{\r
FMTID fmtid ; // semantic name of a section\r
- DWORD dwOffset ; // offset from start of whole property set \r
+ DWORD dwOffset ; // offset from start of whole property set\r
// stream to the section\r
} FORMATIDOFFSET;\r
\r
-typedef struct PROPERTYIDOFFSET \r
+typedef struct PROPERTYIDOFFSET\r
{\r
DWORD propid; // name of a property\r
- DWORD dwOffset; // offset from the start of the section to that \r
+ DWORD dwOffset; // offset from the start of the section to that\r
// property type/value pair\r
} PROPERTYIDOFFSET;\r
\r
PROPERTYIDOFFSET rgPropIDOffset[]; // Array of property locations\r
} PROPERTYSECTIONHEADER;\r
\r
-typedef struct SERIALIZEDPROPERTYVALUE \r
+typedef struct SERIALIZEDPROPERTYVALUE\r
{\r
DWORD dwType; // type tag\r
BYTE rgb[]; // the actual property value\r
/*\r
typedef struct tagENTRY {\r
DWORD propid; // Property ID\r
- DWORD cb; // Count of bytes in the string, including the null \r
+ DWORD cb; // Count of bytes in the string, including the null\r
// at the end.\r
- char sz[cb]; // Zero-terminated string. Code page as indicated \r
+ char sz[cb]; // Zero-terminated string. Code page as indicated\r
// by property ID one.\r
} ENTRY;\r
\r
typedef struct tagDICTIONARY {\r
DWORD cEntries; // Count of entries in the list.\r
- ENTRY rgEntry[cEntries]; \r
+ ENTRY rgEntry[cEntries];\r
} DICTIONARY;\r
*/\r
\r
// We need to be careful here to get the byte order correct.\r
// This seems to match MS's interpretation.\r
{\r
- sprintf(str, "{%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x}", \r
- *(unsigned long*)(fmtid), \r
- *(unsigned short*)(fmtid+4), \r
+ sprintf(str, "{%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x}",\r
+ *(unsigned long*)(fmtid),\r
+ *(unsigned short*)(fmtid+4),\r
*(unsigned short*)(fmtid+6),\r
*(unsigned char*)(fmtid+8),\r
*(unsigned char*)(fmtid+9),\r
\r
struct ole_property_set * ole_property_set_new(int cProps)\r
{\r
- struct ole_property_set * props \r
- =(struct ole_property_set*)xmalloc(sizeof(struct ole_property_set)); \r
+ struct ole_property_set * props\r
+ =(struct ole_property_set*)xmalloc(sizeof(struct ole_property_set));\r
props->cProps = cProps;\r
- props->dict=NULL; \r
- props->pPropList = (struct ole_property*)xmalloc(cProps*sizeof(struct ole_property)); \r
+ props->dict=NULL;\r
+ props->pPropList = (struct ole_property*)xmalloc(cProps*sizeof(struct ole_property));\r
return props;\r
}\r
\r
\r
for(i=0; i<props->cProps; i++)\r
{\r
- xfree(props->pPropList[i].buf);\r
+ free(props->pPropList[i].buf);\r
// FIXME who owns this memory? Cant free it if it is a pointer into another buff\r
- //xfree(props->pPropList[i]);\r
+ //free(props->pPropList[i]);\r
}\r
\r
if (props->dict != NULL)\r
{\r
- xfree(props->dict->ent_propid);\r
- xfree(props->dict->ent_sz);\r
- xfree(props->dict);\r
+ free(props->dict->ent_propid);\r
+ free(props->dict->ent_sz);\r
+ free(props->dict);\r
}\r
- xfree(props->pPropList);\r
- xfree(props);\r
+ free(props->pPropList);\r
+ free(props);\r
}\r
\r
\r
if (bytes_read>bufsize)\r
{\r
printf("read past end of buffer while reading properties dictionary\n");\r
- xfree(dict->ent_propid);\r
- xfree(dict->ent_sz);\r
- xfree(dict);\r
+ free(dict->ent_propid);\r
+ free(dict->ent_sz);\r
+ free(dict);\r
return NULL;\r
}\r
\r
{\r
printf("reading dictionary, read entry for propid %#x with name length %d > max allowed length of 128\n",\r
dict->ent_propid[ent_read], this_ent_cb);\r
-// xfree(dict->ent_cb);\r
- xfree(dict->ent_propid);\r
- xfree(dict->ent_sz);\r
- xfree(dict);\r
+// free(dict->ent_cb);\r
+ free(dict->ent_propid);\r
+ free(dict->ent_sz);\r
+ free(dict);\r
return NULL;\r
}\r
\r
struct ole_property * get_propterty(struct ole_property_set * props, DWORD propid)\r
{\r
unsigned int i;\r
- \r
+\r
if (props==NULL)\r
return NULL;\r
\r
if (dict_ent != -1)\r
name = props->dict->ent_sz[dict_ent];\r
\r
- wprintf(L"\nproperty %d: has name %s propid %#x, type %#x, and length %d bytes\n", \r
- i, name, props->pPropList[i].propid, \r
+ wprintf(L"\nproperty %d: has name %s propid %#x, type %#x, and length %d bytes\n",\r
+ i, name, props->pPropList[i].propid,\r
props->pPropList[i].dwType, props->pPropList[i].buflen );\r
\r
switch(props->pPropList[i].propid)\r
wprintf(L"%#x %s\n", props->dict->ent_propid[j], (props->dict->ent_sz[j]));\r
break;\r
case 1:\r
- printf("This specifies codepage %d (1200=Unicode, 1252=Ansi).\n", \r
+ printf("This specifies codepage %d (1200=Unicode, 1252=Ansi).\n",\r
*(USHORT*)(props->pPropList[i].buf) );\r
break;\r
case 0x80000000:\r
- printf("This specifies locale %d .\n", \r
+ printf("This specifies locale %d .\n",\r
*(unsigned short*)(props->pPropList[i].buf) );\r
break;\r
default:\r
switch(props->pPropList[i].dwType)\r
{\r
case VT_BSTR: //=8\r
- // the prefix bytecount is still there \r
+ // the prefix bytecount is still there\r
wprintf(L"This has value '%ls'\n", props->pPropList[i].buf+4);\r
break;\r
case VT_UNKNOWN: //=13\r
status=readbytes(prop_file, (char*)prop_header, sizeof(PROPERTYSETHEADER));\r
status=readbytes(prop_file, (char*)fmt_id_os, sizeof(FORMATIDOFFSET));\r
\r
- if ( (prop_header->wByteOrder != 0xFFFE) || (prop_header->wFormat != 0) \r
+ if ( (prop_header->wByteOrder != 0xFFFE) || (prop_header->wFormat != 0)\r
|| (prop_header->dwReserved != 1) || (fmt_id_os->dwOffset !=0x30) )\r
{\r
printf("Not a valid properties set header in file %s\n", prop_file_name);\r
psect_header = (PROPERTYSECTIONHEADER *)xrealloc(psect_header, psect_header->cbSection);\r
section_buff = (char*)psect_header;\r
\r
- status=readbytes(prop_file, (char*)(psect_header->rgPropIDOffset), \r
+ status=readbytes(prop_file, (char*)(psect_header->rgPropIDOffset),\r
psect_header->cbSection - sizeof(PROPERTYSECTIONHEADER));\r
\r
property_set = ole_property_set_new(psect_header->cProperties);\r
for (i=0; i< psect_header->cProperties; i++)\r
{\r
property_set->pPropList[i].propid = psect_header->rgPropIDOffset[i].propid;\r
- \r
-// property_set->pPropList[i].buf \r
+\r
+// property_set->pPropList[i].buf\r
// = section_buff + psect_header->rgPropIDOffset[i].dwOffset + 4;\r
\r
property_set->pPropList[i].buf = (char*)xmalloc(property_set->pPropList[i].buflen);\r
\r
for (i=0; i< property_set->cProps; i++)\r
if (property_set->pPropList[i].propid==0)\r
- property_set->dict=read_dictionary(property_set->pPropList[i].dwType, \r
- property_set->pPropList[i].buf, \r
+ property_set->dict=read_dictionary(property_set->pPropList[i].dwType,\r
+ property_set->pPropList[i].buf,\r
property_set->pPropList[i].buflen);\r
\r
fclose(prop_file);\r
- xfree(prop_header);\r
- xfree(psect_header);\r
- xfree(fmt_id_os);\r
+ free(prop_header);\r
+ free(psect_header);\r
+ free(fmt_id_os);\r
\r
- return property_set; \r
+ return property_set;\r
}\r
\r
struct ole_property_set * read_ole_properties(char* source_file_name, char* properties_file_name)\r
char * prop_file_name;\r
struct ole_property_set * strips_property_set=NULL;\r
struct ole_property_set * summary_property_set=NULL;\r
- \r
+\r
if ( (source_file_name==NULL) && (properties_file_name==NULL) )\r
return NULL;\r
\r
if (source_file_name!=NULL)\r
prop_file_name = (char*)xmalloc(strlen(source_file_name)+40);\r
- else \r
+ else\r
prop_file_name = properties_file_name;\r
\r
strcpy(prop_file_name, source_file_name);\r
\r
debug_pause();\r
\r
- xfree(prop_file_name);\r
+ free(prop_file_name);\r
ole_property_set_delete(summary_property_set);\r
\r
return strips_property_set;\r
\r
//FILE* gpx_in_file=NULL;\r
\r
-char * gpx_elem_name[] = \r
+char * gpx_elem_name[] =\r
{\r
"unknown-element",\r
"wpt",\r
{\r
if(pt==NULL)\r
return;\r
- xfree(pt->name);\r
- xfree(pt->desc);\r
- xfree(pt);\r
+ free(pt->name);\r
+ free(pt->desc);\r
+ free(pt);\r
}\r
\r
struct gpxpt * gpxpt_copy(struct gpxpt * otherpt)\r
return;\r
for (i=0; i<rte->rtept_list_count; i++)\r
gpxpt_delete(rte->rtept_list[i]);\r
- xfree(rte->rtept_list);\r
- xfree(rte->name);\r
- xfree(rte);\r
+ free(rte->rtept_list);\r
+ free(rte->name);\r
+ free(rte);\r
}\r
\r
struct gpxtrk * gpxtrk_new()\r
return;\r
for (i=0; i<trk->trkpt_list_count; i++)\r
gpxpt_delete(trk->trkpt_list[i]);\r
- xfree(trk->trkpt_list);\r
- xfree(trk);\r
+ free(trk->trkpt_list);\r
+ free(trk);\r
}\r
\r
struct gpx_data * gpx_data_new()\r
if(data==NULL)\r
return;\r
\r
- xfree(data->data_source_name);\r
+ free(data->data_source_name);\r
for (i=0; i<data->wpt_list_count; i++)\r
gpxpt_delete(data->wpt_list[i]);\r
for (i=0; i<data->rte_list_count; i++)\r
gpxrte_delete(data->rte_list[i]);\r
for (i=0; i<data->trk_list_count; i++)\r
gpxtrk_delete(data->trk_list[i]);\r
- xfree(data->wpt_list);\r
- xfree(data->rte_list);\r
- xfree(data->trk_list);\r
- xfree(data);\r
+ free(data->wpt_list);\r
+ free(data->rte_list);\r
+ free(data->trk_list);\r
+ free(data);\r
}\r
\r
void print_wptlist(struct gpxpt ** wpt_list, int wpt_list_count)\r
int i;\r
printf("Global waypoints:\n");\r
for (i=0; i<wpt_list_count; i++)\r
- printf("wpt: lat=%f, lon=%f, name='%s', desc='%s'\n", \r
+ printf("wpt: lat=%f, lon=%f, name='%s', desc='%s'\n",\r
wpt_list[i]->lat, wpt_list[i]->lon, wpt_list[i]->name, wpt_list[i]->desc);\r
}\r
\r
int i;\r
printf("Route '%s' with %d route-points:\n", rte->name, rte->rtept_list_count);\r
for (i=0; i<rte->rtept_list_count; i++)\r
- printf("rtept: lat=%f, lon=%f, name='%s', desc='%s'\n", \r
+ printf("rtept: lat=%f, lon=%f, name='%s', desc='%s'\n",\r
(rte->rtept_list)[i]->lat, (rte->rtept_list)[i]->lon,\r
(rte->rtept_list)[i]->name, (rte->rtept_list)[i]->desc);\r
}\r
int i;\r
printf("Track with %d track-points:\n", trk->trkpt_list_count);\r
for (i=0; i<trk->trkpt_list_count; i++)\r
- printf("trkpt: lat=%f, lon=%f\n", \r
+ printf("trkpt: lat=%f, lon=%f\n",\r
trk->trkpt_list[i]->lat, trk->trkpt_list[i]->lon);\r
}\r
\r
}\r
\r
char* get_att(char* match, const char **atts)\r
-{ \r
+{\r
const char **avp = &atts[0];\r
- while (*avp) { \r
- if (strcmp(avp[0], match) == 0) \r
+ while (*avp) {\r
+ if (strcmp(avp[0], match) == 0)\r
return (char *)avp[1];\r
avp+=2;\r
}\r
}\r
current_main_element=GPX_ELEM_TYPE_RTEPT;\r
\r
- thisrte->rtept_list=(struct gpxpt **)xrealloc(thisrte->rtept_list, \r
+ thisrte->rtept_list=(struct gpxpt **)xrealloc(thisrte->rtept_list,\r
(thisrte->rtept_list_count+1)*sizeof(struct gpxpt *));\r
thisrte->rtept_list[thisrte->rtept_list_count] = gpxpt_new();\r
sscanf(get_att("lat", atts), "%lf", &(thisrte->rtept_list[thisrte->rtept_list_count]->lat));\r
}\r
current_main_element=0;\r
\r
-// printf("read end of track%d, with %d points\n", \r
+// printf("read end of track%d, with %d points\n",\r
// dat->trk_list_count,\r
-// dat->trk_list[dat->trk_list_count-1]->trkpt_list_count); \r
+// dat->trk_list[dat->trk_list_count-1]->trkpt_list_count);\r
}\r
\r
// just eat <trkseg>: we join all track segments as a single track\r
}\r
current_main_element=GPX_ELEM_TYPE_TRKPT;\r
\r
- thistrk->trkpt_list=(struct gpxpt **)xrealloc(thistrk->trkpt_list, \r
+ thistrk->trkpt_list=(struct gpxpt **)xrealloc(thistrk->trkpt_list,\r
(thistrk->trkpt_list_count+1)*sizeof(struct gpxpt *));\r
thistrk->trkpt_list[thistrk->trkpt_list_count]=gpxpt_new();\r
sscanf(get_att("lat", atts), "%lf", &(thistrk->trkpt_list[thistrk->trkpt_list_count]->lat));\r
//break;\r
case GPX_ELEM_TYPE_TRKPT:\r
default:\r
- xfree(nameval);\r
+ free(nameval);\r
break;\r
}\r
}\r
// break;\r
case GPX_ELEM_TYPE_TRKPT:\r
default:\r
- xfree(desc);\r
+ free(desc);\r
break;\r
}\r
}\r
\r
#define GPX_NUM_ELEM_HANDLERS 10\r
\r
-gpx_elm_start_handler gpx_start_elm_handler[] = \r
+gpx_elm_start_handler gpx_start_elm_handler[] =\r
{\r
&startunkn,\r
&startwpt,\r
&startsrc\r
};\r
\r
-gpx_elm_end_handler gpx_end_elm_handler[] = \r
+gpx_elm_end_handler gpx_end_elm_handler[] =\r
{\r
&endunkn,\r
&endwpt,\r
int i = get_gpx_type_ndx(name);\r
gpx_start_elm_handler[i](userData, name, atts);\r
\r
- xfree(cdata);\r
+ free(cdata);\r
cdata=NULL;\r
cdata_length=0;\r
\r
printf("Importing data from %s\n", gpx_in_file_name);\r
gpx_in_file = fopen(gpx_in_file_name, "r");\r
}\r
- \r
+\r
if(gpx_in_file==NULL)\r
{\r
fprintf(stderr, "Unable to open GPX file %s\n", gpx_in_file_name);\r
exit(1);\r
}\r
\r
- do \r
+ do\r
{\r
size_t len = fread(buf, 1, sizeof(buf), gpx_in_file);\r
done = len < sizeof(buf);\r
- if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) \r
+ if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR)\r
{\r
fprintf(stderr,\r
"%s at line %d\n",\r
{\r
}\r
\r
- xfree(cdata);\r
+ free(cdata);\r
\r
return all_data;\r
}\r
debug_pause();\r
exit(-1);\r
}\r
-//#ifdef _DEBUG\r
-// obj = _malloc_dbg(size, _NORMAL_BLOCK, __FILE__, __LINE__ );\r
-//#else\r
obj = malloc(size);\r
-//#endif\r
if (!obj)\r
{\r
fprintf(stderr, "Unable to allocate %d bytes of memory.\n", size);\r
exit(-1);\r
}\r
\r
-#ifdef _DEBUG\r
-#ifdef MEMTRACE\r
- printf("Malloc'd %d bytes at %lx\n", size, obj);\r
-#endif\r
-#endif\r
-\r
return obj;\r
}\r
\r
exit(-1);\r
}\r
\r
-#ifdef _DEBUG\r
-#ifdef MEMTRACE\r
- printf("reallocing from %lx\n", ptr);\r
-#endif\r
-#endif\r
-\r
-//#ifdef _DEBUG\r
-// obj = _realloc_dbg(ptr, size, _NORMAL_BLOCK, __FILE__, __LINE__ );\r
-//#else\r
obj = realloc(ptr, size);\r
-//#endif\r
if (!obj)\r
{\r
fprintf(stderr, "Unable to (re)allocate %d bytes of memory.\n", size);\r
exit(-1);\r
}\r
\r
-#ifdef _DEBUG\r
-#ifdef MEMTRACE\r
- printf("realloc'd %d bytes at %lx\n", size, obj);\r
-#endif\r
-#endif\r
-\r
return obj;\r
}\r
\r
-void xfree(void * obj)\r
-{\r
-//#ifdef _DEBUG\r
-// _free_dbg(obj, _NORMAL_BLOCK);\r
-//#else\r
-\r
-#ifdef _DEBUG\r
-#ifdef MEMTRACE\r
- printf("freeing mem at %lx\n", obj);\r
-#endif\r
-#endif\r
-\r
- free(obj);\r
-// #endif\r
-}\r
-\r
char * str2ascii(char* str)\r
{\r
int i;\r
}\r
\r
char * strappend(char* str1, char* str2)\r
-// create a new string \r
+// create a new string\r
{\r
int len1=strlen(str1);\r
int len2=strlen(str2);\r
struct gpx_data* all_gpx=NULL;\r
struct ole_property_set * strips_properties=NULL;\r
struct ole_property * prop = NULL;\r
- struct contents * conts;\r
+ struct contents * conts=NULL;\r
\r
char* temp_str=NULL;\r
\r
-// int verify_eof_flag = 0;\r
-\r
opts.explore_flag=0;\r
opts.use_gpx_route=0;\r
opts.verbose_flag=2;\r
#ifdef MEMCHK\r
// Call _CrtCheckMemory at every allocation and deallocation request.\r
SET_CRT_DEBUG_FIELD(_CRTDBG_CHECK_ALWAYS_DF);\r
- // Keep freed memory blocks in the heaps linked list, assign them the _FREE_BLOCK type, \r
+ // Keep freed memory blocks in the heaps linked list, assign them the _FREE_BLOCK type,\r
// and fill them with the byte value 0xDD.\r
SET_CRT_DEBUG_FIELD(_CRTDBG_DELAY_FREE_MEM_DF);\r
- // Perform automatic leak checking at program exit via a call to _CrtDumpMemoryLeaks \r
- // and generate an error report if the application failed to free all the memory \r
+ // Perform automatic leak checking at program exit via a call to _CrtDumpMemoryLeaks\r
+ // and generate an error report if the application failed to free all the memory\r
// it allocated.\r
SET_CRT_DEBUG_FIELD(_CRTDBG_LEAK_CHECK_DF);\r
#endif\r
if (all_gpx==NULL)\r
printf("Didn't read any usable data from %s ???\n",mpst_in_file_name);\r
printf("Read %d waypoints, %d routes and %d tracks from file %s\n",\r
- all_gpx->wpt_list_count, all_gpx->rte_list_count, \r
+ all_gpx->wpt_list_count, all_gpx->rte_list_count,\r
all_gpx->trk_list_count, mpst_in_file_name);\r
- printf("Importing this data as %d lines\n", \r
+ printf("Importing this data as %d lines\n",\r
all_gpx->rte_list_count + all_gpx->trk_list_count);\r
}\r
\r
prop = get_propterty(strips_properties, 0x60002);\r
if ((prop!=NULL) && (prop->buf != NULL) )\r
{\r
- opts.st_version_num = *(int*)(prop->buf); \r
+ opts.st_version_num = *(int*)(prop->buf);\r
printf("Autoroute/S&T version in %s is %d\n", opts.source_file_name, opts.st_version_num);\r
}\r
prop = get_propterty(strips_properties, 0x10000);\r
if ((prop!=NULL) && (prop->buf != NULL) )\r
{\r
- opts.MapName = (WCHAR*)(prop->buf + 4); \r
+ opts.MapName = (WCHAR*)(prop->buf + 4);\r
wprintf(L"MapName is %ls\n", opts.MapName);\r
if(wcscmp(opts.MapName, L"USA")==0)\r
opts.isUSA=1;\r
\r
// check the contents stream\r
//if(opts.explore_flag)\r
+ if(opts.source_file_name)\r
{\r
temp_str = strappend(opts.source_file_name, ".Contents\\Contents");\r
conts = read_contents(temp_str);\r
ole_property_set_delete(strips_properties);\r
contents_delete(conts);\r
\r
- xfree(cmdpath);\r
- xfree(ppin_in_file_name);\r
- xfree(jour_in_file_name);\r
- xfree(annot_in_file_name);\r
- xfree(gpx_in_file_name);\r
- xfree(gpx_out_file_name);\r
- xfree(pcx5_out_file_name);\r
- xfree(import_file_name);\r
- xfree(opts.source_file_name);\r
- xfree(contents_dir_name);\r
- xfree(mpst_in_file_name);\r
- \r
+ free(cmdpath);\r
+ free(ppin_in_file_name);\r
+ free(jour_in_file_name);\r
+ free(annot_in_file_name);\r
+ free(gpx_in_file_name);\r
+ free(gpx_out_file_name);\r
+ free(pcx5_out_file_name);\r
+ free(import_file_name);\r
+ free(opts.source_file_name);\r
+ free(contents_dir_name);\r
+ free(mpst_in_file_name);\r
+\r
if (opts.verbose_flag>5)\r
printf("Done freeing all\n");\r
\r
_flushall();\r
\r
#ifdef _DEBUG\r
-// _CrtDumpMemoryLeaks(); \r
+// _CrtDumpMemoryLeaks();\r
#endif\r
debug_pause();\r
}\r
# PROP Ignore_Export_Lib 0\r
# PROP Target_Dir ""\r
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
-# ADD CPP /nologo /Zp1 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /Zp1 /Za /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
# ADD RSC /l 0x409 /d "NDEBUG"\r
BSC32=bscmake.exe\r
# ADD BSC32 /nologo\r
LINK32=link.exe\r
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
-# ADD LINK32 libexpat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /pdbtype:sept\r
-# SUBTRACT LINK32 /profile /map /debug\r
+# ADD LINK32 libexpat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# SUBTRACT LINK32 /profile /map\r
\r
!ENDIF \r
\r
\r
!IF "$(CFG)" == "st2gpx - Win32 Release"\r
\r
-# ADD CPP /Za\r
-\r
!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
\r
+# SUBTRACT CPP /FA<none>\r
+\r
!ENDIF \r
\r
# End Source File\r
\r
!IF "$(CFG)" == "st2gpx - Win32 Release"\r
\r
-# ADD CPP /Za\r
-\r
!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
\r
+# ADD CPP /Za\r
+\r
!ENDIF \r
\r
# End Source File\r
# Begin Source File\r
\r
SOURCE=.\debug.c\r
-\r
-!IF "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
# End Source File\r
# Begin Source File\r
\r
# Begin Source File\r
\r
SOURCE=.\journey.c\r
-\r
-!IF "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
# End Source File\r
# Begin Source File\r
\r
SOURCE=.\nannol.c\r
-\r
-!IF "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
# End Source File\r
# Begin Source File\r
\r
SOURCE=.\ppinutil.c\r
-\r
-!IF "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
# End Source File\r
# Begin Source File\r
\r
# Begin Source File\r
\r
SOURCE=.\pushpins.cpp\r
-\r
-!IF "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
# ADD CPP /Ze\r
-\r
-!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-# ADD CPP /Ze /W4 /Gi\r
-\r
-!ENDIF \r
-\r
# End Source File\r
# Begin Source File\r
\r
SOURCE=.\readgpx.c\r
-\r
-!IF "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
# End Source File\r
# Begin Source File\r
\r
SOURCE=.\readmpst.c\r
-\r
-!IF "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
# End Source File\r
# Begin Source File\r
\r
SOURCE=.\st2gpx.c\r
-# ADD CPP /Za\r
# End Source File\r
# Begin Source File\r
\r
SOURCE=.\writegpx.c\r
-\r
-!IF "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
# End Source File\r
# Begin Source File\r
\r
SOURCE=.\writepcx.c\r
-\r
-!IF "$(CFG)" == "st2gpx - Win32 Release"\r
-\r
-# ADD CPP /Za\r
-\r
-!ELSEIF "$(CFG)" == "st2gpx - Win32 Debug"\r
-\r
-!ENDIF \r
-\r
# End Source File\r
# End Group\r
# Begin Group "Header Files"\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\msado15.tlh\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\msado15.tli\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\ToDo.txt\r
# End Source File\r
# End Target\r
//#define MEMCHK
//#define DEBUG_STDOUT
-//#define MEMTRACE
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
extern struct st2gpx_options opts;
void * xmalloc(size_t size);
void * xrealloc(void* ptr, size_t size);
-void xfree(void * obj);
char * str2ascii(char* str);
int readbytes(FILE* file, char* buf, int bytes2read);
//nannol.c
gpx_write_point(gpx_out_file, pt, GPX_RTEPT, opt_elms);\r
\r
gpxpt_delete(pt);\r
- xfree(opt_elms);\r
+ free(opt_elms);\r
}\r
\r
void gpx_write_jour_header(FILE* gpx_out_file)\r
if (ppplist->pushpin_list[i]==NULL)\r
break;\r
\r
- optlen = strlen(ppplist->pushpin_list[i]->UdName) \r
+ optlen = strlen(ppplist->pushpin_list[i]->UdName)\r
+ strlen(ppplist->pushpin_list[i]->NoteShort) + 60;\r
opt_elms = (char*)xmalloc(optlen);\r
\r
pt->lon = ppplist->pushpin_list[i]->lon;\r
\r
gpx_write_point(gpx_out_file, pt, GPX_WPT, opt_elms);\r
- xfree(opt_elms);\r
+ free(opt_elms);\r
}\r
fprintf(gpx_out_file, "\n");\r
gpxpt_delete(pt);\r
}\r
}\r
\r
-void gpx_write_all(char* gpx_out_file_name, \r
- struct pushpin_safelist *ppplist, \r
+void gpx_write_all(char* gpx_out_file_name,\r
+ struct pushpin_safelist *ppplist,\r
struct journey * jour,\r
struct annotations * annots)\r
{\r
str[6]=0;\r
}\r
\r
-void comp_mk_uniq_idents(char* ident_array, int ident_to_mk_uniq, int count_idents) \r
+void comp_mk_uniq_idents(char* ident_array, int ident_to_mk_uniq, int count_idents)\r
// compare ident_to_mk_uniq-th ident to all preceding idents,\r
// and make ident_to_mk_uniq-th ident\r
{\r
}\r
else\r
count_ppins=ppplist->num_pushpins;\r
- \r
+\r
ident_array=(char*)xmalloc(7*(count_ppins + jour->count_rtepts));\r
\r
// copy ppin names before we start mangling them\r
// copy rtept names before we start mangling them\r
for (i=0; i< (jour->count_rtepts); i++)\r
{\r
- memcpy(ident_array + 7*(count_ppins) +7*i, \r
- jour->rtept_list[i].text1, \r
+ memcpy(ident_array + 7*(count_ppins) +7*i,\r
+ jour->rtept_list[i].text1,\r
6);\r
garmin_ident_crush(ident_array + 7*(count_ppins) + 7*i);\r
}\r
// Create a unique ident if neccesary.\r
// Only check against list of already-verified unique\r
comp_mk_uniq_idents(ident_array, i, count_ppins + jour->count_rtepts);\r
- \r
+\r
strncpy(ppplist->pushpin_list[i]->garmin_ident, ident_array+7*i, 7);\r
}\r
\r
ppplist->pushpin_list[j]->garmin_ident,\r
7);\r
// Although the journey stream doesn't associate this pushpin with the route,\r
- // I have decided to. Again, this is questionable \r
+ // I have decided to. Again, this is questionable\r
// but not likely to happen anyway.\r
jour->rtept_list[i].pushpin = ppplist->pushpin_list[j];\r
}\r
else\r
{\r
// no matching wpt for this rtept, so we need to create one.\r
- // We just create the garmin_ident in the jour-rtept here, \r
+ // We just create the garmin_ident in the jour-rtept here,\r
// later we will write a corresponding wpt to the pcx file.\r
comp_mk_uniq_idents(ident_array, count_ppins + i, count_ppins + jour->count_rtepts);\r
- } \r
+ }\r
}\r
// set the jour-rtept garmin_ident\r
memcpy(jour->rtept_list[i].garmin_ident,\r
ident_array + 7*(count_ppins) +7*i,\r
7);\r
}\r
- xfree(ident_array);\r
+ free(ident_array);\r
}\r
\r
void gar_write_header(FILE* gar_out_file)\r
\r
memcpy(desc, rtept->text1,39);\r
strpad(desc, 40);\r
- \r
- pcx5_write_pt(file, \r
- pt_type, \r
- rtept->garmin_ident, \r
- scaled2deg(f_wpt_head->scaled_lat), \r
- scaled2deg(f_wpt_head->scaled_lon), \r
- timedate, \r
- alt, \r
- desc, \r
- proximity, \r
+\r
+ pcx5_write_pt(file,\r
+ pt_type,\r
+ rtept->garmin_ident,\r
+ scaled2deg(f_wpt_head->scaled_lat),\r
+ scaled2deg(f_wpt_head->scaled_lon),\r
+ timedate,\r
+ alt,\r
+ desc,\r
+ proximity,\r
symbol);\r
- \r
+\r
// }\r
// else if(pt_type==GAR_RTE)\r
// {\r